#include <iostream>
#include <memory>
#include <vector>
#include <deque>
#include <stack>
using namespace std;

/* 通过继承用vector写一个stack */
template <typename T>
class Stack : public vector<T>
{
public:
    Stack()
    {}

    ~Stack()
    {}

    void push(T &num)
    {
        push_back(num);     //入栈 = 数组尾插
    }

    // T pop()
    // {
    //     T temp = back();    //出栈 = 数组尾删
    //     pop_back();
    //     return temp;
    // }
};

/* 通过组合用vector写一个stack,这个时候可以修改vector为deque等等*/
template <typename T, typename Cons = vector<T>>  
class StackV2
{
public:
    StackV2()
    {}
    void push(T &num)
    {
        con.push_back(num);
    }

    Cons con;
};


class A
{
public:
    A(int num) : m_num(num)
    {

    }
    int m_num;
};



void func(int &num)
{
    num++;
    cout << num << endl;
}

// void func(const int &num) 
// {
//     num++;
//     cout << num << endl;
// }

void func(int &&num)
{
    num++;
    cout << num << endl;
}

void func(A *pa)
{

}

void func(const shared_ptr<A> &p)
{

}


int main(int argc, char **argv)
{
    int num = 10;

    int &lnum = num;
    //int &lnum2 = 10;
    int &&rnum = 10;

    A a(5);
    A &la = a;
    A &&la2 = A(5);

    func(num);
    func(10);
    func(&a);
    func(shared_ptr<A>(&a));
    
    StackV2<int> s;
    StackV2<int, deque<int>> s2;
    
    stack<int> s3;
    stack<int, deque<int>> s4;
    return 0;
}